﻿
Imports System.Windows.Forms
Public Class Aplication
#Region "Propiedades"
    Private Shared strAppName As String = ""
    Private Shared intScreenWidth As Integer = 0
    Private Shared intScreenHeight As Integer = 0
    Public Shared Property Name() As String
        Get
            Return strAppName
        End Get
        Set(ByVal value As String)
            strAppName = value
        End Set
    End Property
   
    Public Shared Property ScreenWidth() As Integer
        Get
            Return intScreenWidth
        End Get
        Set(ByVal value As Integer)
            intScreenWidth = value
        End Set
    End Property
    Public Shared Property ScreenHeight() As Integer
        Get
            Return intScreenHeight
        End Get
        Set(ByVal value As Integer)
            intScreenHeight = value
        End Set
    End Property
#End Region

    Public Class MessageBox
#Region "Propiedades"
        Private Shared strEmpresa As String = ""
        Private Shared strEmpresaNombreCorto As String = ""
        Private Shared strModulo As String
        Public Shared Property Empresa() As String
            Get
                Return strEmpresa
            End Get
            Set(ByVal value As String)
                strEmpresa = value
            End Set
        End Property
        Public Shared Property EmpresaNombreCorto() As String
            Get
                Return strEmpresaNombreCorto
            End Get
            Set(ByVal value As String)
                strEmpresaNombreCorto = value
            End Set
        End Property
        Public Shared Property Modulo() As String
            Get
                Return strModulo
            End Get
            Set(ByVal value As String)
                strModulo = value
            End Set
        End Property
        Public Shared ReadOnly Property MensajeTitulo() As String
            Get
                Dim strValue As String = ""
                strValue = EmpresaNombreCorto & " - " & Modulo
                Return strValue
            End Get
        End Property
#End Region
#Region "Function"
        Private Shared strMensajeQuestionGrabar As String = "Desea guardar los datos"
        Private Shared strMensajeQuestionEliminar As String = "Esta seguro de eliminar el registro"
        Private Shared strMensajeQuestionEliminarMultiple As String = "Esta seguro de eliminar los registros seleccionados"

        Public Shared Function MensajeExclamation(ByVal Mensaje As String, Optional ByVal Titulo As String = "") As System.Windows.Forms.DialogResult

            Dim strTitulo As String = ""
            If Titulo.Trim = "" Then
                strTitulo = Vichama.Configurations.Aplication.MessageBox.MensajeTitulo
            Else
                strTitulo = Titulo.Trim
            End If

            Return System.Windows.Forms.MessageBox.Show(Mensaje, strTitulo, _
            System.Windows.Forms.MessageBoxButtons.OK, _
            System.Windows.Forms.MessageBoxIcon.Exclamation)

        End Function
        Public Shared Function MensajeQuestion(ByVal Mensaje As String, Optional ByVal Titulo As String = "") As System.Windows.Forms.DialogResult

            Dim strTitulo As String = ""
            If Titulo.Trim = "" Then
                strTitulo = Vichama.Configurations.Aplication.MessageBox.MensajeTitulo
            Else
                strTitulo = Titulo.Trim
            End If

            Return System.Windows.Forms.MessageBox.Show(Mensaje, strTitulo, _
            System.Windows.Forms.MessageBoxButtons.YesNo, _
            System.Windows.Forms.MessageBoxIcon.Question)

        End Function

        Public Shared Function MensajeInformation(ByVal Mensaje As String, Optional ByVal Titulo As String = "") As System.Windows.Forms.DialogResult

            Dim strTitulo As String = ""
            If Titulo.Trim = "" Then
                strTitulo = Vichama.Configurations.Aplication.MessageBox.MensajeTitulo
            Else
                strTitulo = Titulo.Trim
            End If

            Return System.Windows.Forms.MessageBox.Show(Mensaje, strTitulo, _
            System.Windows.Forms.MessageBoxButtons.OK, _
            System.Windows.Forms.MessageBoxIcon.Information)

        End Function
        Public Shared Function MensajeError(ByVal Mensaje As String, Optional ByVal Titulo As String = "") As System.Windows.Forms.DialogResult

            Dim strTitulo As String = ""
            If Titulo.Trim = "" Then
                strTitulo = Vichama.Configurations.Aplication.MessageBox.MensajeTitulo
            Else
                strTitulo = Titulo.Trim
            End If

            Return System.Windows.Forms.MessageBox.Show(Mensaje, strTitulo, _
            System.Windows.Forms.MessageBoxButtons.OK, _
            System.Windows.Forms.MessageBoxIcon.Error)

        End Function

        Public Shared Function QuestionGrabar(Optional ByVal Mensaje As String = "") As System.Windows.Forms.DialogResult

            Dim Value As String = ""

            If Mensaje.Trim = "" Then
                Value = strMensajeQuestionGrabar
            Else
                Value = Mensaje.Trim
            End If

            Return MensajeQuestion(Value)

        End Function
        Public Shared Function MensajeEliminar(Optional ByVal Mensaje As String = "") As System.Windows.Forms.DialogResult

            Dim Value As String = ""

            If Mensaje.Trim = "" Then
                Value = strMensajeQuestionEliminar
            Else
                Value = Mensaje
            End If

            Return MensajeQuestion(Value)

        End Function
        Public Shared Function MensajeEliminarMultiple(Optional ByVal Mensaje As String = "") As System.Windows.Forms.DialogResult

            Dim Value As String = ""

            If Mensaje.Trim = "" Then
                Value = strMensajeQuestionEliminarMultiple
            Else
                Value = Mensaje
            End If

            Return MensajeQuestion(Value)

        End Function
#End Region
#Region "Sub"
        Private Shared strMensajeOperacion As String = "Operacion realizada satisfactoriamente"
        Private Shared strMensajeInformacionGrabar As String = "Datos guardados satisfactoriamente..."
        Public Shared Sub MensajeGrabar()
            MensajeInformation(strMensajeInformacionGrabar)
        End Sub
        Public Shared Sub MensajeOperacion()
            MensajeInformation(strMensajeOperacion)
        End Sub
        Public Shared Sub MensajeExclamation2(ByVal Mensaje As String, Optional ByVal Titulo As String = "")

            Dim strTitulo As String = ""
            If Titulo.Trim = "" Then
                strTitulo = Vichama.Configurations.Aplication.MessageBox.MensajeTitulo
            Else
                strTitulo = Titulo.Trim
            End If

            System.Windows.Forms.MessageBox.Show(Mensaje, strTitulo, _
            System.Windows.Forms.MessageBoxButtons.OK, _
            System.Windows.Forms.MessageBoxIcon.Exclamation)

        End Sub
#End Region
    End Class
    Public Class Passwords
        Private Shared strPasswordIni As String = ""
        Private Shared strClaveSqlScript As String = "SQL2005_db_p0p3"
        Private Shared strPassworBackup As String = "p0p3_rar"
        Public Shared Property PasswordIni() As String
            Get
                Return strPasswordIni
            End Get
            Set(ByVal value As String)
                strPasswordIni = value
            End Set
        End Property
        Public Shared ReadOnly Property PasswordSqlScript() As String
            Get
                Return strClaveSqlScript
            End Get
        End Property
        Public Shared ReadOnly Property PasswordBackup() As String
            Get
                Return strPassworBackup
            End Get
        End Property
    End Class
    Public Class FechayHora
        Private Shared lngFechaServerApp As Long = 0
        Public Shared Property FechaLong() As Long
            Get
                Return lngFechaServerApp
            End Get
            Set(ByVal value As Long)
                lngFechaServerApp = value
            End Set
        End Property
        Public Shared ReadOnly Property FechaString() As String
            Get
                Return DateTime.FromFileTime(lngFechaServerApp).ToShortDateString
            End Get
        End Property
        Public Shared ReadOnly Property FechaDate() As Date
            Get
                Return DateTime.FromFileTime(lngFechaServerApp)
            End Get
        End Property
        Public Shared ReadOnly Property FechaText() As String
            Get
                Dim strValue As String = ""
                strValue = FechaDate.ToLongDateString
                Return strValue
            End Get
        End Property
        Public Shared ReadOnly Property FechaHoraString() As String
            Get
                Return FechaDate.ToShortTimeString
            End Get
        End Property
        Public Shared ReadOnly Property FechaAnio() As Integer
            Get
                Return FechaDate.Year
            End Get
        End Property
        Public Shared ReadOnly Property FechaMes() As Integer
            Get
                Return FechaDate.Month
            End Get
        End Property
        Public Shared ReadOnly Property FechaDia() As Integer
            Get
                Return FechaDate.Day
            End Get
        End Property
        Public Shared ReadOnly Property FechaMesNombre(Optional ByVal Abreviatura As Boolean = False) As String
            Get
                Return MonthName(FechaMes, Abreviatura)
            End Get
        End Property
        Public Shared ReadOnly Property FechaAnioMesDia() As String
            Get
                Dim strValue As String = ""
                strValue = FechaAnio & FechaMes & Vichama.Components.Cadena.Format(FechaDia, "00")
                Return strValue
            End Get
        End Property

    End Class
End Class
